package jc16;
/*练习方案一*/
public class jincheng3 {
    public static void main(String[] args) {
        myjinc p = new myjinc();
        myjinc p1 = new myjinc();
        myjinc p2 = new myjinc();
        myjinc p3 = new myjinc();
        p.start();
        p1.start();
        p2.start();
        p3.start();
    }
}
class myjinc extends Thread{
    static int a = 100;
    Object o = new Object();
    @Override
    public void run() {
        while (true){
            synchronized (o) {
                if (a > 0) {
                    System.out.println(getName() + "=" + a--);
                }
                if (a <= 0) break;
            }
        }
    }
}
